#include <QApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <QQmlProperty>
#include <QQmlComponent>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQmlApplicationEngine engine1;
    engine1.load(QUrl(QStringLiteral("qrc:/main.qml")));

    QQmlEngine engine;
    QQmlComponent component(&engine, QUrl("qrc:/main.qml"));
    QObject *object = component.create();

    qDebug() << "Property value:" << QQmlProperty::read(object, "hey").toString();
    QQmlProperty::write(object, "hey", "Hello, Qt!");

    qDebug() << "Property value:" << object->property("hey").toString();
    object->setProperty("hey", "Hello, QML!");
    qDebug() << "Property value:" << object->property("hey").toString();

    return app.exec();
}
